#include "VS_Outputs.hlsl"
#include "ConstantBuffers.hlsl"
#include "terrain_textures.hlsl"

float4 BasicPS_yellow( float4 Pos : SV_POSITION ) : SV_Target
{
    return float4( 1.0f, 1.0f, 0.0f, 1.0f );    // Yellow, with Alpha = 1
}

float4 BasicPS_modelobject( VS_OUTPUT_POS_COLOUR dataIn ) : SV_Target
{
   return dataIn.vColour;		// data from vertex shader
}

/*
float4 BasicPS_terrain( VS_OUTPUT_POS_COLOUR_NORMAL dataIn ) : SV_Target
{
    return dataIn.vColour;		// data from vertex shader
}
*/
float4 BasicPS_terrain( VS_OUTPUT_POS_MULTI_TEX dataIn ) : SV_Target
{
	float fSand = 0.125f;
	float fGrass = 0.00390625;
	float fRock = 0.0625f;
	float fSnow = 0.125f;
	
	float4 result;
	
	//result = float4(0.5f,0.5f,0.5f,0.0f);

//	result = textureGrass.Sample(TextureSamplerGrass, dataIn.vTexCoords);

	result = textureSand.Sample(TextureSamplerSand, float2(dataIn.vTexCoords.x * fSand, dataIn.vTexCoords.y * fSand))*dataIn.vTexWeights.w;
	result += textureGrass.Sample(TextureSamplerGrass, float2(dataIn.vTexCoords.x * fGrass, dataIn.vTexCoords.y * fGrass))*dataIn.vTexWeights.x;
	result += textureRock.Sample(TextureSamplerRock, float2(dataIn.vTexCoords.x * fRock, dataIn.vTexCoords.y * fRock))*dataIn.vTexWeights.y;
	result += textureSnow.Sample(TextureSamplerSnow, float2(dataIn.vTexCoords.x * fSnow, dataIn.vTexCoords.y * fSnow))*dataIn.vTexWeights.z;  

    return result;		
}